package v1

import (
	"gf-admin-api-template/internal/model"
	"github.com/gogf/gf/v2/frame/g"
)

type UserListReq struct {
	g.Meta   `path:"/admin/setting/user" tags:"user" method:"get" summary:"用户列表"`
	Nickname string `json:"nickname" in:"query" v:"max-length:20" dc:"用户"`
	Account  string `json:"account" in:"query" v:"max-length:20"`
	PageCommonReq
}
type UserListRes struct {
	Total int               `json:"total"`
	List  []*model.UserInfo `json:"list"`
}

type UserCreateReq struct {
	g.Meta   `path:"/admin/setting/user" tags:"user" method:"post" summary:"创建用户"`
	Nickname string `json:"nickname" v:"required|length:1,20" dc:"用户"`
	Account  string `json:"account" v:"required|length:1,20"`
	Roles    []uint `json:"roles" v:"required"`
}

type UserUpdateReq struct {
	g.Meta   `path:"/admin/setting/user/{Id}" tags:"user" method:"put" summary:"更新用户"`
	Id       uint   `json:"id" in:"path" v:"required|min:1"`
	Nickname string `json:"nickname" v:"required|length:1,20" dc:"用户"`
	Account  string `json:"account" v:"required|length:1,20"`
	Roles    []uint `json:"roles" v:"required"`
}

type UserDeleteReq struct {
	g.Meta `path:"/admin/setting/user/{Id}" tags:"user" method:"delete" summary:"删除用户"`
	Id     uint `json:"id" in:"path" v:"required|min:1"`
}

type UserResetPwReq struct {
	g.Meta `path:"/admin/setting/user/{Id}/resetpassword" tags:"user" method:"put" summary:"重置密码"`
	Id     uint `json:"id" in:"path" v:"required|min:1"`
}

type UserChangePwReq struct {
	g.Meta      `path:"/admin/setting/user/changepw" tags:"user" method:"put" summary:"修改密码"`
	OldPassword string `json:"oldPassword" v:"required|length:5,20"`
	Password    string `json:"password" v:"required|length:5,20"`
	Password1   string `json:"password1" v:"required|length:5,20|same:Password"`
}
